#region "Base64"

/*
 * ####     Developer Name : Wang Yucai
 * 
 * ####     Development Tool : Microsoft VisualStudio 2010 Ultimate Edition
 * 
 * ####     Create Time : 2014-07-08 15:01:53
 * 
 * ####     Namespace : Masterduner.SourceStudio.Practices.DevelopmentLibrary
 * 
 * ####     Type Name : Base64
 * 
 * ####     Full Name : Masterduner.SourceStudio.Practices.DevelopmentLibrary.Base64
 * 
 * ####     Machine Name : GLCHQWYCWINW7
 * 
 * ####     UserName : GUOCOLAND/wangyucai
 * 
 * ####     CLR Version : 4.0.30319.18444
 * 
 * ####     Target Framework Version : 4.0
 */

#endregion

using System;

namespace Masterduner.SourceStudio.Practices.DevelopmentLibrary
{
    /// <summary>
    /// <para>Masterduner.SourceStudio.Practices.DevelopmentLibrary.Base64</para>
    /// <para>
    /// 提供了Base64算法的基本操作。
    /// </para>
    /// </summary>
    /// <remarks>
    /// <para>Target Framework Version : 4.0</para>
    /// </remarks>
    public static class Base64
    {
        #region CreateString
        /// <summary>
        /// 使用Base64算法创建乱码字符串。
        /// </summary>
        /// <param name="input">输入的字节数据。</param>
        /// <returns>乱码字符串。</returns>
        /// <remarks>
        /// 如果<paramref name="input"/>为空指针，则返回空指针。
        /// </remarks>
        static public string CreateString(byte[] input)
        {
            return input.IsNull() ? null : Convert.ToBase64String(input);
        }
        #endregion

        #region InverseOperation
        /// <summary>
        /// 对乱码字符串执行Base64逆运算，并获取字节数据。
        /// </summary>
        /// <param name="input">乱码字符串。</param>
        /// <returns>字节数组。</returns>
        /// <remarks>如果<paramref name="input"/>为空指针，则返回空指针。</remarks>
        static public byte[] InverseOperation(string input)
        {
            return input.IsNull() ? null : Convert.FromBase64String(input);
        }
        #endregion
    }
}

#region README

/*
 * ####     ©2014 Wang Yucai
 * 
 * ####     Contact me
 *                  
 *                  E-mail : Masterduner@Yeah.net
 *                  Mobile : 13621384677
 *                  QQ : 180261899
 */

#endregion